package com.hello.system.service.impl;

import java.util.List;
import com.hello.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hello.system.mapper.AlarmRuleConfigMapper;
import com.hello.system.domain.AlarmRuleConfig;
import com.hello.system.service.IAlarmRuleConfigService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 告警规则配置Service业务层处理
 * 
 * @author hello
 * @date 2025-09-09
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class AlarmRuleConfigServiceImpl extends ServiceImpl<AlarmRuleConfigMapper, AlarmRuleConfig> implements IAlarmRuleConfigService 
{
    private final AlarmRuleConfigMapper alarmRuleConfigMapper;

    /**
     * 查询告警规则配置
     * 
     * @param ruleId 告警规则配置主键
     * @return 告警规则配置
     */
    @Override
    public AlarmRuleConfig selectAlarmRuleConfigByRuleId(Long ruleId)
    {
        return alarmRuleConfigMapper.selectAlarmRuleConfigByRuleId(ruleId);
    }

    /**
     * 查询告警规则配置列表
     * 
     * @param alarmRuleConfig 告警规则配置
     * @return 告警规则配置
     */
    @Override
    public List<AlarmRuleConfig> selectAlarmRuleConfigList(AlarmRuleConfig alarmRuleConfig)
    {
        return alarmRuleConfigMapper.selectAlarmRuleConfigList(alarmRuleConfig);
    }

    /**
     * 新增告警规则配置
     * 
     * @param alarmRuleConfig 告警规则配置
     * @return 结果
     */
    @Override
    public int insertAlarmRuleConfig(AlarmRuleConfig alarmRuleConfig)
    {
        alarmRuleConfig.setCreateTime(DateUtils.getNowDate());
        return alarmRuleConfigMapper.insertAlarmRuleConfig(alarmRuleConfig);
    }

    /**
     * 修改告警规则配置
     * 
     * @param alarmRuleConfig 告警规则配置
     * @return 结果
     */
    @Override
    public int updateAlarmRuleConfig(AlarmRuleConfig alarmRuleConfig)
    {
        alarmRuleConfig.setUpdateTime(DateUtils.getNowDate());
        return alarmRuleConfigMapper.updateAlarmRuleConfig(alarmRuleConfig);
    }


    /**
     * 批量删除告警规则配置
     * 
     * @param ruleIds 需要删除的告警规则配置主键
     * @return 结果
     */
    @Override
    public int deleteAlarmRuleConfigByRuleIds(Long[] ruleIds)
    {
        return alarmRuleConfigMapper.deleteAlarmRuleConfigByRuleIds(ruleIds);
    }

    /**
     * 删除告警规则配置信息
     * 
     * @param ruleId 告警规则配置主键
     * @return 结果
     */
    @Override
    public int deleteAlarmRuleConfigByRuleId(Long ruleId)
    {
        return alarmRuleConfigMapper.deleteAlarmRuleConfigByRuleId(ruleId);
    }
}
